
package com.example.cia.database.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.example.cia.database.mysql.dao.impl.SightsDAO;

public class getSightsServlet extends HttpServlet{

	/**
	 * 
	 */
	private static final long serialVersionUID = -2887277047097890388L;

	public void doGet(HttpServletRequest request,HttpServletResponse response)
			throws ServletException,IOException{
		//获取对应ID的景点描述
				String id = request.getParameter("data");

				//获取服务对象
				SightsDAO service = new SightsDAO();
				
				//获取景点描述
				String description = service.getDescription(Integer.parseInt(id));
				
				//返回信息
				response.setCharacterEncoding("UTF-8");
				response.setContentType("text/html");
				PrintWriter out = response.getWriter();
				out.print(description);
		        out.flush();
		        out.close();
	}
}
